package com.example.demo.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "商品项实体")
public class GoodsItem {

    @Id
    @ApiModelProperty("商品编号")
    private long id;

    @NotNull
    @ApiModelProperty("商品名")
    private String name;

    @ApiModelProperty("商品数量")
    private int num;

    @ApiModelProperty("商品单价")
    private double price;

    @ManyToMany(fetch = FetchType.EAGER,cascade = CascadeType.REFRESH)
    private List<Supplier> suppliers=new ArrayList<>();

}
